package com.itheima_01.day08;

import java.util.Scanner;

public class LoginSys {
    public static void main(String[] args) {
        String username = "ad";
        String password = "123";
        String yzm="ZmxzJy1314";
        Scanner sc = new Scanner(System.in);
        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入验证码：");
            String yanZM = sc.nextLine();
            if (yanZM.equalsIgnoreCase(yzm)) {
                System.out.println("请输入用户名：");
                String scUsername = sc.nextLine();
                if (username.equals(scUsername)) {
                    System.out.println("请输入密码：");
                    String scPassword = sc.nextLine();
                    if (password.equals(scPassword)) {
                        System.out.println("登陆成功！");
                        break;
                    } else if (i == 3) {
                        System.out.println("今日已达上限，请明天再来！");
                    } else {
                        System.out.println("登录密码错误！您还有" + (3 - i) + "次机会！");
                    }

                } else {
                    System.out.println("用户不存在！您还有" + (3 - i) + "次机会！");
                }
            } else {
                System.out.println("验证码错误！请重新输入！");
            }
        }
    }
}
